<template>
  <div class="compitem">
    <div class="compname">{{title}}</div>
    <el-input style="width:100px;margin-right:10px;" type="number" v-model="value"></el-input>
    <el-select v-model="select" style="width:90px;" placeholder="请选择">
    <el-option
      v-for="item in list"
      :key="item.id"
      :label="item.name"
      :value="item.id">
    </el-option>
  </el-select>
  </div>
</template>
<script>
import { string } from 'jszip/lib/support'
export default {
  props:{
   title:{
     type:String
   },
   name:{
     type:String
   },
   val:{
     type:String
   },
  

  },
  data() {
    return {
      value:'',
      select:'1',
      list:[{
        name:'天',
        id:'1'
      },{
        name:'周',
        id:'2'
      },{
        name:'月',
        id:'3'
      },]
    }
  },
  created() {
    // this.value=this.val
    // this.select=this.selected
    if(!this.val){
      return
    }
    var data=JSON.parse(this.val)
    this.value=data.val
    this.select=data.select+''
  },
  watch: {
    value:function(params) {
      // console.log(this)
     
      this.$emit('func',{name:this.name,data:{val:this.value,select:this.select}})
    },
    select:function(){
      
      this.$emit('func',{name:this.name,data:{val:this.value,select:this.select}})

    }
  },
}
</script>
<style lang="scss" scoped>
.compitem{
  .compname{
    font-size: 14px;
    width: 90px;
  //  padding: 0 15px;
    // padding-right:15px;

  }
  width: 100%;
  display: flex;
   align-items: center;
}
</style>